<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><link rel="stylesheet" type="text/css" href="style.css" /><script type="text/javascript" src="highlight.js"></script></head><body><pre><span class="hs-pragma">{-# LANGUAGE BangPatterns, CPP, Rank2Types #-}</span><span>
</span><span id="line-2"></span><span>
</span><span id="line-3"></span><span class="hs-comment">-- |</span><span>
</span><span id="line-4"></span><span class="hs-comment">-- Module      : Data.Text.Internal.Encoding.Fusion</span><span>
</span><span id="line-5"></span><span class="hs-comment">-- Copyright   : (c) Tom Harper 2008-2009,</span><span>
</span><span id="line-6"></span><span class="hs-comment">--               (c) Bryan O'Sullivan 2009,</span><span>
</span><span id="line-7"></span><span class="hs-comment">--               (c) Duncan Coutts 2009</span><span>
</span><span id="line-8"></span><span class="hs-comment">--</span><span>
</span><span id="line-9"></span><span class="hs-comment">-- License     : BSD-style</span><span>
</span><span id="line-10"></span><span class="hs-comment">-- Maintainer  : bos@serpentine.com</span><span>
</span><span id="line-11"></span><span class="hs-comment">-- Stability   : experimental</span><span>
</span><span id="line-12"></span><span class="hs-comment">-- Portability : portable</span><span>
</span><span id="line-13"></span><span class="hs-comment">--</span><span>
</span><span id="line-14"></span><span class="hs-comment">-- /Warning/: this is an internal module, and does not have a stable</span><span>
</span><span id="line-15"></span><span class="hs-comment">-- API or name. Functions in this module may not check or enforce</span><span>
</span><span id="line-16"></span><span class="hs-comment">-- preconditions expected by public modules. Use at your own risk!</span><span>
</span><span id="line-17"></span><span class="hs-comment">--</span><span>
</span><span id="line-18"></span><span class="hs-comment">-- Fusible 'Stream'-oriented functions for converting between 'Text'</span><span>
</span><span id="line-19"></span><span class="hs-comment">-- and several common encodings.</span><span>
</span><span id="line-20"></span><span>
</span><span id="line-21"></span><span class="hs-keyword">module</span><span> </span><span class="hs-identifier">Data.Text.Internal.Encoding.Fusion</span><span>
</span><span id="line-22"></span><span>    </span><span class="hs-special">(</span><span>
</span><span id="line-23"></span><span>    </span><span class="annot"><span class="hs-comment">-- * Streaming</span></span><span>
</span><span id="line-24"></span><span>      </span><span class="annot"><a href="Data.Text.Internal.Encoding.Fusion.html#streamASCII"><span class="hs-identifier">streamASCII</span></a></span><span>
</span><span id="line-25"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Text.Internal.Encoding.Fusion.html#streamUtf8"><span class="hs-identifier">streamUtf8</span></a></span><span>
</span><span id="line-26"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Text.Internal.Encoding.Fusion.html#streamUtf16LE"><span class="hs-identifier">streamUtf16LE</span></a></span><span>
</span><span id="line-27"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Text.Internal.Encoding.Fusion.html#streamUtf16BE"><span class="hs-identifier">streamUtf16BE</span></a></span><span>
</span><span id="line-28"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Text.Internal.Encoding.Fusion.html#streamUtf32LE"><span class="hs-identifier">streamUtf32LE</span></a></span><span>
</span><span id="line-29"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Text.Internal.Encoding.Fusion.html#streamUtf32BE"><span class="hs-identifier">streamUtf32BE</span></a></span><span>
</span><span id="line-30"></span><span>
</span><span id="line-31"></span><span>    </span><span class="annot"><span class="hs-comment">-- * Unstreaming</span></span><span>
</span><span id="line-32"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Text.Internal.Encoding.Fusion.html#unstream"><span class="hs-identifier">unstream</span></a></span><span>
</span><span id="line-33"></span><span>
</span><span id="line-34"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-keyword">module</span><span> </span><span class="annot"><a href="Data.Text.Internal.Encoding.Fusion.Common.html"><span class="hs-identifier">Data.Text.Internal.Encoding.Fusion.Common</span></a></span><span>
</span><span id="line-35"></span><span>    </span><span class="hs-special">)</span><span> </span><span class="hs-keyword">where</span><span class="hs-cpp">

#if defined(ASSERTS)
</span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">Control.Exception</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">assert</span><span class="hs-special">)</span><span class="hs-cpp">
#endif
</span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../bytestring/src/Data.ByteString.Internal.html#"><span class="hs-identifier">Data.ByteString.Internal</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../bytestring/src/Data.ByteString.Internal.html#ByteString"><span class="hs-identifier">ByteString</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../bytestring/src/Data.ByteString.Internal.html#mallocByteString"><span class="hs-identifier">mallocByteString</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../bytestring/src/Data.ByteString.Internal.html#memcpy"><span class="hs-identifier">memcpy</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-41"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="Data.Text.Internal.Fusion.html"><span class="hs-identifier">Data.Text.Internal.Fusion</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.Text.Internal.Fusion.Types.html#Step"><span class="hs-identifier">Step</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Text.Internal.Fusion.Types.html#Stream"><span class="hs-identifier">Stream</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-42"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="Data.Text.Internal.Fusion.Size.html"><span class="hs-identifier">Data.Text.Internal.Fusion.Size</span></a></span><span>
</span><span id="line-43"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="Data.Text.Encoding.Error.html"><span class="hs-identifier">Data.Text.Encoding.Error</span></a></span><span>
</span><span id="line-44"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="Data.Text.Internal.Encoding.Fusion.Common.html"><span class="hs-identifier">Data.Text.Internal.Encoding.Fusion.Common</span></a></span><span>
</span><span id="line-45"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="Data.Text.Internal.Unsafe.Char.html"><span class="hs-identifier">Data.Text.Internal.Unsafe.Char</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.Text.Internal.Unsafe.Char.html#unsafeChr"><span class="hs-identifier">unsafeChr</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Text.Internal.Unsafe.Char.html#unsafeChr8"><span class="hs-identifier">unsafeChr8</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Text.Internal.Unsafe.Char.html#unsafeChr32"><span class="hs-identifier">unsafeChr32</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-46"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="Data.Text.Internal.Unsafe.Shift.html"><span class="hs-identifier">Data.Text.Internal.Unsafe.Shift</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.Text.Internal.Unsafe.Shift.html#shiftL"><span class="hs-identifier">shiftL</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Text.Internal.Unsafe.Shift.html#shiftR"><span class="hs-identifier">shiftR</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-47"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="Data.Text.Internal.Functions.html"><span class="hs-identifier">Data.Text.Internal.Functions</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.Text.Internal.Functions.html#unsafeWithForeignPtr"><span class="hs-identifier">unsafeWithForeignPtr</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-48"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Data.Word.html#"><span class="hs-identifier">Data.Word</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Word.html#Word8"><span class="hs-identifier">Word8</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Word.html#Word16"><span class="hs-identifier">Word16</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Word.html#Word32"><span class="hs-identifier">Word32</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-49"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Foreign.ForeignPtr.html#"><span class="hs-identifier">Foreign.ForeignPtr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.ForeignPtr.html#ForeignPtr"><span class="hs-identifier">ForeignPtr</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-50"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Foreign.Storable.html#"><span class="hs-identifier">Foreign.Storable</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/Foreign.Storable.html#pokeByteOff"><span class="hs-identifier">pokeByteOff</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-51"></span><span class="hs-keyword">import</span><span> </span><span class="hs-keyword">qualified</span><span> </span><span class="annot"><a href="../../bytestring/src/Data.ByteString.html#"><span class="hs-identifier">Data.ByteString</span></a></span><span> </span><span class="hs-keyword">as</span><span> </span><span class="annot"><span class="hs-identifier">B</span></span><span>
</span><span id="line-52"></span><span class="hs-keyword">import</span><span> </span><span class="hs-keyword">qualified</span><span> </span><span class="annot"><a href="../../bytestring/src/Data.ByteString.Unsafe.html#"><span class="hs-identifier">Data.ByteString.Unsafe</span></a></span><span> </span><span class="hs-keyword">as</span><span> </span><span class="annot"><span class="hs-identifier">B</span></span><span>
</span><span id="line-53"></span><span class="hs-keyword">import</span><span> </span><span class="hs-keyword">qualified</span><span> </span><span class="annot"><a href="Data.Text.Internal.Encoding.Utf8.html"><span class="hs-identifier">Data.Text.Internal.Encoding.Utf8</span></a></span><span> </span><span class="hs-keyword">as</span><span> </span><span class="annot"><span class="hs-identifier">U8</span></span><span>
</span><span id="line-54"></span><span class="hs-keyword">import</span><span> </span><span class="hs-keyword">qualified</span><span> </span><span class="annot"><a href="Data.Text.Internal.Encoding.Utf16.html"><span class="hs-identifier">Data.Text.Internal.Encoding.Utf16</span></a></span><span> </span><span class="hs-keyword">as</span><span> </span><span class="annot"><span class="hs-identifier">U16</span></span><span>
</span><span id="line-55"></span><span class="hs-keyword">import</span><span> </span><span class="hs-keyword">qualified</span><span> </span><span class="annot"><a href="Data.Text.Internal.Encoding.Utf32.html"><span class="hs-identifier">Data.Text.Internal.Encoding.Utf32</span></a></span><span> </span><span class="hs-keyword">as</span><span> </span><span class="annot"><span class="hs-identifier">U32</span></span><span>
</span><span id="line-56"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="Data.Text.Unsafe.html"><span class="hs-identifier">Data.Text.Unsafe</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.IO.Unsafe.html#unsafeDupablePerformIO"><span class="hs-identifier">unsafeDupablePerformIO</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-57"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="Data.Text.Internal.ByteStringCompat.html"><span class="hs-identifier">Data.Text.Internal.ByteStringCompat</span></a></span><span>
</span><span id="line-58"></span><span>
</span><span id="line-59"></span><span class="annot"><a href="Data.Text.Internal.Encoding.Fusion.html#streamASCII"><span class="hs-identifier hs-type">streamASCII</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../bytestring/src/Data.ByteString.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Text.Internal.Fusion.Types.html#Stream"><span class="hs-identifier hs-type">Stream</span></a></span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Char"><span class="hs-identifier hs-type">Char</span></a></span><span>
</span><span id="line-60"></span><span id="streamASCII"><span class="annot"><span class="annottext">streamASCII :: ByteString -&gt; Stream Char
</span><a href="Data.Text.Internal.Encoding.Fusion.html#streamASCII"><span class="hs-identifier hs-var hs-var">streamASCII</span></a></span></span><span> </span><span id="local-6989586621679108715"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679108715"><span class="hs-identifier hs-var">bs</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Int -&gt; Step Int Char) -&gt; Int -&gt; Size -&gt; Stream Char
forall a s. (s -&gt; Step s a) -&gt; s -&gt; Size -&gt; Stream a
</span><a href="Data.Text.Internal.Fusion.Types.html#Stream"><span class="hs-identifier hs-var">Stream</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Step Int Char
</span><a href="#local-6989586621679108713"><span class="hs-identifier hs-var">next</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int -&gt; Size
</span><a href="Data.Text.Internal.Fusion.Size.html#maxSize"><span class="hs-identifier hs-var">maxSize</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679108711"><span class="hs-identifier hs-var">l</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-61"></span><span>    </span><span class="hs-keyword">where</span><span>
</span><span id="line-62"></span><span>      </span><span id="local-6989586621679108711"><span class="annot"><span class="annottext">l :: Int
</span><a href="#local-6989586621679108711"><span class="hs-identifier hs-var hs-var">l</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; Int
</span><a href="../../bytestring/src/Data.ByteString.html#length"><span class="hs-identifier hs-var">B.length</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679108715"><span class="hs-identifier hs-var">bs</span></a></span><span>
</span><span id="line-63"></span><span>      </span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="#local-6989586621679108713"><span class="hs-pragma hs-type">next</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-64"></span><span>      </span><span id="local-6989586621679108713"><span class="annot"><span class="annottext">next :: Int -&gt; Step Int Char
</span><a href="#local-6989586621679108713"><span class="hs-identifier hs-var hs-var">next</span></a></span></span><span> </span><span id="local-6989586621679108705"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679108705"><span class="hs-identifier hs-var">i</span></a></span></span><span>
</span><span id="line-65"></span><span>          </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679108705"><span class="hs-identifier hs-var">i</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3E%3D"><span class="hs-operator hs-var">&gt;=</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679108711"><span class="hs-identifier hs-var">l</span></a></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Step Int Char
forall s a. Step s a
</span><a href="Data.Text.Internal.Fusion.Types.html#Done"><span class="hs-identifier hs-var">Done</span></a></span><span>
</span><span id="line-66"></span><span>          </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Char -&gt; Int -&gt; Step Int Char
forall s a. a -&gt; s -&gt; Step s a
</span><a href="Data.Text.Internal.Fusion.Types.html#Yield"><span class="hs-identifier hs-var">Yield</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Word8 -&gt; Char
</span><a href="Data.Text.Internal.Unsafe.Char.html#unsafeChr8"><span class="hs-identifier hs-var">unsafeChr8</span></a></span><span> </span><span class="annot"><span class="annottext">Word8
</span><a href="#local-6989586621679108702"><span class="hs-identifier hs-var">x1</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679108705"><span class="hs-identifier hs-var">i</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span class="hs-special">)</span><span>
</span><span id="line-67"></span><span>          </span><span class="hs-keyword">where</span><span>
</span><span id="line-68"></span><span>            </span><span id="local-6989586621679108702"><span class="annot"><span class="annottext">x1 :: Word8
</span><a href="#local-6989586621679108702"><span class="hs-identifier hs-var hs-var">x1</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; Int -&gt; Word8
</span><a href="../../bytestring/src/Data.ByteString.Unsafe.html#unsafeIndex"><span class="hs-identifier hs-var">B.unsafeIndex</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679108715"><span class="hs-identifier hs-var">bs</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679108705"><span class="hs-identifier hs-var">i</span></a></span><span>
</span><span id="line-69"></span><span class="hs-pragma">{-# DEPRECATED</span><span> </span><span class="hs-pragma">streamASCII</span><span> </span><span class="hs-pragma">&quot;Do not use this function&quot;</span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-70"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="hs-pragma">[</span><span class="hs-pragma">0</span><span class="hs-pragma">]</span><span> </span><span class="annot"><a href="Data.Text.Internal.Encoding.Fusion.html#streamASCII"><span class="hs-pragma hs-type">streamASCII</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-71"></span><span>
</span><span id="line-72"></span><span class="hs-comment">-- | /O(n)/ Convert a 'ByteString' into a 'Stream Char', using UTF-8</span><span>
</span><span id="line-73"></span><span class="hs-comment">-- encoding.</span><span>
</span><span id="line-74"></span><span class="annot"><a href="Data.Text.Internal.Encoding.Fusion.html#streamUtf8"><span class="hs-identifier hs-type">streamUtf8</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Data.Text.Encoding.Error.html#OnDecodeError"><span class="hs-identifier hs-type">OnDecodeError</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../bytestring/src/Data.ByteString.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Text.Internal.Fusion.Types.html#Stream"><span class="hs-identifier hs-type">Stream</span></a></span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Char"><span class="hs-identifier hs-type">Char</span></a></span><span>
</span><span id="line-75"></span><span id="streamUtf8"><span class="annot"><span class="annottext">streamUtf8 :: OnDecodeError -&gt; ByteString -&gt; Stream Char
</span><a href="Data.Text.Internal.Encoding.Fusion.html#streamUtf8"><span class="hs-identifier hs-var hs-var">streamUtf8</span></a></span></span><span> </span><span id="local-6989586621679108699"><span class="annot"><span class="annottext">OnDecodeError
</span><a href="#local-6989586621679108699"><span class="hs-identifier hs-var">onErr</span></a></span></span><span> </span><span id="local-6989586621679108698"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679108698"><span class="hs-identifier hs-var">bs</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Int -&gt; Step Int Char) -&gt; Int -&gt; Size -&gt; Stream Char
forall a s. (s -&gt; Step s a) -&gt; s -&gt; Size -&gt; Stream a
</span><a href="Data.Text.Internal.Fusion.Types.html#Stream"><span class="hs-identifier hs-var">Stream</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Step Int Char
</span><a href="#local-6989586621679108697"><span class="hs-identifier hs-var">next</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int -&gt; Size
</span><a href="Data.Text.Internal.Fusion.Size.html#maxSize"><span class="hs-identifier hs-var">maxSize</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679108696"><span class="hs-identifier hs-var">l</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-76"></span><span>    </span><span class="hs-keyword">where</span><span>
</span><span id="line-77"></span><span>      </span><span id="local-6989586621679108696"><span class="annot"><span class="annottext">l :: Int
</span><a href="#local-6989586621679108696"><span class="hs-identifier hs-var hs-var">l</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; Int
</span><a href="../../bytestring/src/Data.ByteString.html#length"><span class="hs-identifier hs-var">B.length</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679108698"><span class="hs-identifier hs-var">bs</span></a></span><span>
</span><span id="line-78"></span><span>      </span><span id="local-6989586621679108697"><span class="annot"><span class="annottext">next :: Int -&gt; Step Int Char
</span><a href="#local-6989586621679108697"><span class="hs-identifier hs-var hs-var">next</span></a></span></span><span> </span><span id="local-6989586621679108675"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679108675"><span class="hs-identifier hs-var">i</span></a></span></span><span>
</span><span id="line-79"></span><span>          </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679108675"><span class="hs-identifier hs-var">i</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3E%3D"><span class="hs-operator hs-var">&gt;=</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679108696"><span class="hs-identifier hs-var">l</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Step Int Char
forall s a. Step s a
</span><a href="Data.Text.Internal.Fusion.Types.html#Done"><span class="hs-identifier hs-var">Done</span></a></span><span>
</span><span id="line-80"></span><span>          </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Word8 -&gt; Bool
</span><a href="Data.Text.Internal.Encoding.Utf8.html#validate1"><span class="hs-identifier hs-var">U8.validate1</span></a></span><span> </span><span class="annot"><span class="annottext">Word8
</span><a href="#local-6989586621679108673"><span class="hs-identifier hs-var">x1</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Char -&gt; Int -&gt; Step Int Char
forall s a. a -&gt; s -&gt; Step s a
</span><a href="Data.Text.Internal.Fusion.Types.html#Yield"><span class="hs-identifier hs-var">Yield</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Word8 -&gt; Char
</span><a href="Data.Text.Internal.Unsafe.Char.html#unsafeChr8"><span class="hs-identifier hs-var">unsafeChr8</span></a></span><span> </span><span class="annot"><span class="annottext">Word8
</span><a href="#local-6989586621679108673"><span class="hs-identifier hs-var">x1</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679108675"><span class="hs-identifier hs-var">i</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span class="hs-special">)</span><span>
</span><span id="line-81"></span><span>          </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679108675"><span class="hs-identifier hs-var">i</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3C"><span class="hs-operator hs-var">&lt;</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679108696"><span class="hs-identifier hs-var">l</span></a></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%26%26"><span class="hs-operator hs-var">&amp;&amp;</span></a></span><span> </span><span class="annot"><span class="annottext">Word8 -&gt; Word8 -&gt; Bool
</span><a href="Data.Text.Internal.Encoding.Utf8.html#validate2"><span class="hs-identifier hs-var">U8.validate2</span></a></span><span> </span><span class="annot"><span class="annottext">Word8
</span><a href="#local-6989586621679108673"><span class="hs-identifier hs-var">x1</span></a></span><span> </span><span class="annot"><span class="annottext">Word8
</span><a href="#local-6989586621679108669"><span class="hs-identifier hs-var">x2</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Char -&gt; Int -&gt; Step Int Char
forall s a. a -&gt; s -&gt; Step s a
</span><a href="Data.Text.Internal.Fusion.Types.html#Yield"><span class="hs-identifier hs-var">Yield</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Word8 -&gt; Word8 -&gt; Char
</span><a href="Data.Text.Internal.Encoding.Utf8.html#chr2"><span class="hs-identifier hs-var">U8.chr2</span></a></span><span> </span><span class="annot"><span class="annottext">Word8
</span><a href="#local-6989586621679108673"><span class="hs-identifier hs-var">x1</span></a></span><span> </span><span class="annot"><span class="annottext">Word8
</span><a href="#local-6989586621679108669"><span class="hs-identifier hs-var">x2</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679108675"><span class="hs-identifier hs-var">i</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">2</span></span><span class="hs-special">)</span><span>
</span><span id="line-82"></span><span>          </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679108675"><span class="hs-identifier hs-var">i</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">2</span></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3C"><span class="hs-operator hs-var">&lt;</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679108696"><span class="hs-identifier hs-var">l</span></a></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%26%26"><span class="hs-operator hs-var">&amp;&amp;</span></a></span><span> </span><span class="annot"><span class="annottext">Word8 -&gt; Word8 -&gt; Word8 -&gt; Bool
</span><a href="Data.Text.Internal.Encoding.Utf8.html#validate3"><span class="hs-identifier hs-var">U8.validate3</span></a></span><span> </span><span class="annot"><span class="annottext">Word8
</span><a href="#local-6989586621679108673"><span class="hs-identifier hs-var">x1</span></a></span><span> </span><span class="annot"><span class="annottext">Word8
</span><a href="#local-6989586621679108669"><span class="hs-identifier hs-var">x2</span></a></span><span> </span><span class="annot"><span class="annottext">Word8
</span><a href="#local-6989586621679108666"><span class="hs-identifier hs-var">x3</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Char -&gt; Int -&gt; Step Int Char
forall s a. a -&gt; s -&gt; Step s a
</span><a href="Data.Text.Internal.Fusion.Types.html#Yield"><span class="hs-identifier hs-var">Yield</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Word8 -&gt; Word8 -&gt; Word8 -&gt; Char
</span><a href="Data.Text.Internal.Encoding.Utf8.html#chr3"><span class="hs-identifier hs-var">U8.chr3</span></a></span><span> </span><span class="annot"><span class="annottext">Word8
</span><a href="#local-6989586621679108673"><span class="hs-identifier hs-var">x1</span></a></span><span> </span><span class="annot"><span class="annottext">Word8
</span><a href="#local-6989586621679108669"><span class="hs-identifier hs-var">x2</span></a></span><span> </span><span class="annot"><span class="annottext">Word8
</span><a href="#local-6989586621679108666"><span class="hs-identifier hs-var">x3</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679108675"><span class="hs-identifier hs-var">i</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">3</span></span><span class="hs-special">)</span><span>
</span><span id="line-83"></span><span>          </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679108675"><span class="hs-identifier hs-var">i</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">3</span></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3C"><span class="hs-operator hs-var">&lt;</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679108696"><span class="hs-identifier hs-var">l</span></a></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%26%26"><span class="hs-operator hs-var">&amp;&amp;</span></a></span><span> </span><span class="annot"><span class="annottext">Word8 -&gt; Word8 -&gt; Word8 -&gt; Word8 -&gt; Bool
</span><a href="Data.Text.Internal.Encoding.Utf8.html#validate4"><span class="hs-identifier hs-var">U8.validate4</span></a></span><span> </span><span class="annot"><span class="annottext">Word8
</span><a href="#local-6989586621679108673"><span class="hs-identifier hs-var">x1</span></a></span><span> </span><span class="annot"><span class="annottext">Word8
</span><a href="#local-6989586621679108669"><span class="hs-identifier hs-var">x2</span></a></span><span> </span><span class="annot"><span class="annottext">Word8
</span><a href="#local-6989586621679108666"><span class="hs-identifier hs-var">x3</span></a></span><span> </span><span class="annot"><span class="annottext">Word8
</span><a href="#local-6989586621679108663"><span class="hs-identifier hs-var">x4</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Char -&gt; Int -&gt; Step Int Char
forall s a. a -&gt; s -&gt; Step s a
</span><a href="Data.Text.Internal.Fusion.Types.html#Yield"><span class="hs-identifier hs-var">Yield</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Word8 -&gt; Word8 -&gt; Word8 -&gt; Word8 -&gt; Char
</span><a href="Data.Text.Internal.Encoding.Utf8.html#chr4"><span class="hs-identifier hs-var">U8.chr4</span></a></span><span> </span><span class="annot"><span class="annottext">Word8
</span><a href="#local-6989586621679108673"><span class="hs-identifier hs-var">x1</span></a></span><span> </span><span class="annot"><span class="annottext">Word8
</span><a href="#local-6989586621679108669"><span class="hs-identifier hs-var">x2</span></a></span><span> </span><span class="annot"><span class="annottext">Word8
</span><a href="#local-6989586621679108666"><span class="hs-identifier hs-var">x3</span></a></span><span> </span><span class="annot"><span class="annottext">Word8
</span><a href="#local-6989586621679108663"><span class="hs-identifier hs-var">x4</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679108675"><span class="hs-identifier hs-var">i</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">4</span></span><span class="hs-special">)</span><span>
</span><span id="line-84"></span><span>          </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String
-&gt; String -&gt; OnDecodeError -&gt; Maybe Word8 -&gt; Int -&gt; Step Int Char
forall s.
String
-&gt; String -&gt; OnDecodeError -&gt; Maybe Word8 -&gt; s -&gt; Step s Char
</span><a href="Data.Text.Internal.Encoding.Fusion.html#decodeError"><span class="hs-identifier hs-var">decodeError</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;streamUtf8&quot;</span></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;UTF-8&quot;</span></span><span> </span><span class="annot"><span class="annottext">OnDecodeError
</span><a href="#local-6989586621679108699"><span class="hs-identifier hs-var">onErr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Word8 -&gt; Maybe Word8
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="annot"><span class="annottext">Word8
</span><a href="#local-6989586621679108673"><span class="hs-identifier hs-var">x1</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679108675"><span class="hs-identifier hs-var">i</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span class="hs-special">)</span><span>
</span><span id="line-85"></span><span>          </span><span class="hs-keyword">where</span><span>
</span><span id="line-86"></span><span>            </span><span id="local-6989586621679108673"><span class="annot"><span class="annottext">x1 :: Word8
</span><a href="#local-6989586621679108673"><span class="hs-identifier hs-var hs-var">x1</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int -&gt; Word8
</span><a href="#local-6989586621679108660"><span class="hs-identifier hs-var">idx</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679108675"><span class="hs-identifier hs-var">i</span></a></span><span>
</span><span id="line-87"></span><span>            </span><span id="local-6989586621679108669"><span class="annot"><span class="annottext">x2 :: Word8
</span><a href="#local-6989586621679108669"><span class="hs-identifier hs-var hs-var">x2</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int -&gt; Word8
</span><a href="#local-6989586621679108660"><span class="hs-identifier hs-var">idx</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679108675"><span class="hs-identifier hs-var">i</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span class="hs-special">)</span><span>
</span><span id="line-88"></span><span>            </span><span id="local-6989586621679108666"><span class="annot"><span class="annottext">x3 :: Word8
</span><a href="#local-6989586621679108666"><span class="hs-identifier hs-var hs-var">x3</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int -&gt; Word8
</span><a href="#local-6989586621679108660"><span class="hs-identifier hs-var">idx</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679108675"><span class="hs-identifier hs-var">i</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">2</span></span><span class="hs-special">)</span><span>
</span><span id="line-89"></span><span>            </span><span id="local-6989586621679108663"><span class="annot"><span class="annottext">x4 :: Word8
</span><a href="#local-6989586621679108663"><span class="hs-identifier hs-var hs-var">x4</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int -&gt; Word8
</span><a href="#local-6989586621679108660"><span class="hs-identifier hs-var">idx</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679108675"><span class="hs-identifier hs-var">i</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">3</span></span><span class="hs-special">)</span><span>
</span><span id="line-90"></span><span>            </span><span id="local-6989586621679108660"><span class="annot"><span class="annottext">idx :: Int -&gt; Word8
</span><a href="#local-6989586621679108660"><span class="hs-identifier hs-var hs-var">idx</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; Int -&gt; Word8
</span><a href="../../bytestring/src/Data.ByteString.Unsafe.html#unsafeIndex"><span class="hs-identifier hs-var">B.unsafeIndex</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679108698"><span class="hs-identifier hs-var">bs</span></a></span><span>
</span><span id="line-91"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="hs-pragma">[</span><span class="hs-pragma">0</span><span class="hs-pragma">]</span><span> </span><span class="annot"><a href="Data.Text.Internal.Encoding.Fusion.html#streamUtf8"><span class="hs-pragma hs-type">streamUtf8</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-92"></span><span>
</span><span id="line-93"></span><span class="hs-comment">-- | /O(n)/ Convert a 'ByteString' into a 'Stream Char', using little</span><span>
</span><span id="line-94"></span><span class="hs-comment">-- endian UTF-16 encoding.</span><span>
</span><span id="line-95"></span><span class="annot"><a href="Data.Text.Internal.Encoding.Fusion.html#streamUtf16LE"><span class="hs-identifier hs-type">streamUtf16LE</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Data.Text.Encoding.Error.html#OnDecodeError"><span class="hs-identifier hs-type">OnDecodeError</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../bytestring/src/Data.ByteString.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Text.Internal.Fusion.Types.html#Stream"><span class="hs-identifier hs-type">Stream</span></a></span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Char"><span class="hs-identifier hs-type">Char</span></a></span><span>
</span><span id="line-96"></span><span id="streamUtf16LE"><span class="annot"><span class="annottext">streamUtf16LE :: OnDecodeError -&gt; ByteString -&gt; Stream Char
</span><a href="Data.Text.Internal.Encoding.Fusion.html#streamUtf16LE"><span class="hs-identifier hs-var hs-var">streamUtf16LE</span></a></span></span><span> </span><span id="local-6989586621679108653"><span class="annot"><span class="annottext">OnDecodeError
</span><a href="#local-6989586621679108653"><span class="hs-identifier hs-var">onErr</span></a></span></span><span> </span><span id="local-6989586621679108652"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679108652"><span class="hs-identifier hs-var">bs</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Int -&gt; Step Int Char) -&gt; Int -&gt; Size -&gt; Stream Char
forall a s. (s -&gt; Step s a) -&gt; s -&gt; Size -&gt; Stream a
</span><a href="Data.Text.Internal.Fusion.Types.html#Stream"><span class="hs-identifier hs-var">Stream</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Step Int Char
</span><a href="#local-6989586621679108651"><span class="hs-identifier hs-var">next</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int -&gt; Size
</span><a href="Data.Text.Internal.Fusion.Size.html#maxSize"><span class="hs-identifier hs-var">maxSize</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679108650"><span class="hs-identifier hs-var">l</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. UnsafeShift a =&gt; a -&gt; Int -&gt; a
</span><a href="Data.Text.Internal.Unsafe.Shift.html#shiftR"><span class="hs-operator hs-var">`shiftR`</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-97"></span><span>    </span><span class="hs-keyword">where</span><span>
</span><span id="line-98"></span><span>      </span><span id="local-6989586621679108650"><span class="annot"><span class="annottext">l :: Int
</span><a href="#local-6989586621679108650"><span class="hs-identifier hs-var hs-var">l</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; Int
</span><a href="../../bytestring/src/Data.ByteString.html#length"><span class="hs-identifier hs-var">B.length</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679108652"><span class="hs-identifier hs-var">bs</span></a></span><span>
</span><span id="line-99"></span><span>      </span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="#local-6989586621679108651"><span class="hs-pragma hs-type">next</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-100"></span><span>      </span><span id="local-6989586621679108651"><span class="annot"><span class="annottext">next :: Int -&gt; Step Int Char
</span><a href="#local-6989586621679108651"><span class="hs-identifier hs-var hs-var">next</span></a></span></span><span> </span><span id="local-6989586621679108636"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679108636"><span class="hs-identifier hs-var">i</span></a></span></span><span>
</span><span id="line-101"></span><span>          </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679108636"><span class="hs-identifier hs-var">i</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3E%3D"><span class="hs-operator hs-var">&gt;=</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679108650"><span class="hs-identifier hs-var">l</span></a></span><span>                         </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Step Int Char
forall s a. Step s a
</span><a href="Data.Text.Internal.Fusion.Types.html#Done"><span class="hs-identifier hs-var">Done</span></a></span><span>
</span><span id="line-102"></span><span>          </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679108636"><span class="hs-identifier hs-var">i</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3C"><span class="hs-operator hs-var">&lt;</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679108650"><span class="hs-identifier hs-var">l</span></a></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%26%26"><span class="hs-operator hs-var">&amp;&amp;</span></a></span><span> </span><span class="annot"><span class="annottext">Word16 -&gt; Bool
</span><a href="Data.Text.Internal.Encoding.Utf16.html#validate1"><span class="hs-identifier hs-var">U16.validate1</span></a></span><span> </span><span class="annot"><span class="annottext">Word16
</span><a href="#local-6989586621679108634"><span class="hs-identifier hs-var">x1</span></a></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Char -&gt; Int -&gt; Step Int Char
forall s a. a -&gt; s -&gt; Step s a
</span><a href="Data.Text.Internal.Fusion.Types.html#Yield"><span class="hs-identifier hs-var">Yield</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Word16 -&gt; Char
</span><a href="Data.Text.Internal.Unsafe.Char.html#unsafeChr"><span class="hs-identifier hs-var">unsafeChr</span></a></span><span> </span><span class="annot"><span class="annottext">Word16
</span><a href="#local-6989586621679108634"><span class="hs-identifier hs-var">x1</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679108636"><span class="hs-identifier hs-var">i</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">2</span></span><span class="hs-special">)</span><span>
</span><span id="line-103"></span><span>          </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679108636"><span class="hs-identifier hs-var">i</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">3</span></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3C"><span class="hs-operator hs-var">&lt;</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679108650"><span class="hs-identifier hs-var">l</span></a></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%26%26"><span class="hs-operator hs-var">&amp;&amp;</span></a></span><span> </span><span class="annot"><span class="annottext">Word16 -&gt; Word16 -&gt; Bool
</span><a href="Data.Text.Internal.Encoding.Utf16.html#validate2"><span class="hs-identifier hs-var">U16.validate2</span></a></span><span> </span><span class="annot"><span class="annottext">Word16
</span><a href="#local-6989586621679108634"><span class="hs-identifier hs-var">x1</span></a></span><span> </span><span class="annot"><span class="annottext">Word16
</span><a href="#local-6989586621679108632"><span class="hs-identifier hs-var">x2</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Char -&gt; Int -&gt; Step Int Char
forall s a. a -&gt; s -&gt; Step s a
</span><a href="Data.Text.Internal.Fusion.Types.html#Yield"><span class="hs-identifier hs-var">Yield</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Word16 -&gt; Word16 -&gt; Char
</span><a href="Data.Text.Internal.Encoding.Utf16.html#chr2"><span class="hs-identifier hs-var">U16.chr2</span></a></span><span> </span><span class="annot"><span class="annottext">Word16
</span><a href="#local-6989586621679108634"><span class="hs-identifier hs-var">x1</span></a></span><span> </span><span class="annot"><span class="annottext">Word16
</span><a href="#local-6989586621679108632"><span class="hs-identifier hs-var">x2</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679108636"><span class="hs-identifier hs-var">i</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">4</span></span><span class="hs-special">)</span><span>
</span><span id="line-104"></span><span>          </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String
-&gt; String -&gt; OnDecodeError -&gt; Maybe Word8 -&gt; Int -&gt; Step Int Char
forall s.
String
-&gt; String -&gt; OnDecodeError -&gt; Maybe Word8 -&gt; s -&gt; Step s Char
</span><a href="Data.Text.Internal.Encoding.Fusion.html#decodeError"><span class="hs-identifier hs-var">decodeError</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;streamUtf16LE&quot;</span></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;UTF-16LE&quot;</span></span><span> </span><span class="annot"><span class="annottext">OnDecodeError
</span><a href="#local-6989586621679108653"><span class="hs-identifier hs-var">onErr</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe Word8
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679108636"><span class="hs-identifier hs-var">i</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span class="hs-special">)</span><span>
</span><span id="line-105"></span><span>          </span><span class="hs-keyword">where</span><span>
</span><span id="line-106"></span><span>            </span><span id="local-6989586621679108634"><span class="annot"><span class="annottext">x1 :: Word16
</span><a href="#local-6989586621679108634"><span class="hs-identifier hs-var hs-var">x1</span></a></span></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int -&gt; Word16
</span><a href="#local-6989586621679108625"><span class="hs-identifier hs-var">idx</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679108636"><span class="hs-identifier hs-var">i</span></a></span><span>       </span><span class="annot"><span class="annottext">Word16 -&gt; Word16 -&gt; Word16
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int -&gt; Word16
</span><a href="#local-6989586621679108625"><span class="hs-identifier hs-var">idx</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679108636"><span class="hs-identifier hs-var">i</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Word16 -&gt; Int -&gt; Word16
forall a. UnsafeShift a =&gt; a -&gt; Int -&gt; a
</span><a href="Data.Text.Internal.Unsafe.Shift.html#shiftL"><span class="hs-operator hs-var">`shiftL`</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">8</span></span><span class="hs-special">)</span><span>
</span><span id="line-107"></span><span>            </span><span id="local-6989586621679108632"><span class="annot"><span class="annottext">x2 :: Word16
</span><a href="#local-6989586621679108632"><span class="hs-identifier hs-var hs-var">x2</span></a></span></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int -&gt; Word16
</span><a href="#local-6989586621679108625"><span class="hs-identifier hs-var">idx</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679108636"><span class="hs-identifier hs-var">i</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">2</span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Word16 -&gt; Word16 -&gt; Word16
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int -&gt; Word16
</span><a href="#local-6989586621679108625"><span class="hs-identifier hs-var">idx</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679108636"><span class="hs-identifier hs-var">i</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">3</span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Word16 -&gt; Int -&gt; Word16
forall a. UnsafeShift a =&gt; a -&gt; Int -&gt; a
</span><a href="Data.Text.Internal.Unsafe.Shift.html#shiftL"><span class="hs-operator hs-var">`shiftL`</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">8</span></span><span class="hs-special">)</span><span>
</span><span id="line-108"></span><span>            </span><span id="local-6989586621679108625"><span class="annot"><span class="annottext">idx :: Int -&gt; Word16
</span><a href="#local-6989586621679108625"><span class="hs-identifier hs-var hs-var">idx</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Word8 -&gt; Word16
</span><a href="Data.Text.Internal.Encoding.Fusion.html#word8ToWord16"><span class="hs-identifier hs-var">word8ToWord16</span></a></span><span> </span><span class="annot"><span class="annottext">(Word8 -&gt; Word16) -&gt; (Int -&gt; Word8) -&gt; Int -&gt; Word16
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; Int -&gt; Word8
</span><a href="../../bytestring/src/Data.ByteString.Unsafe.html#unsafeIndex"><span class="hs-identifier hs-var">B.unsafeIndex</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679108652"><span class="hs-identifier hs-var">bs</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-identifier hs-type">Int</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Word.html#Word16"><span class="hs-identifier hs-type">Word16</span></a></span><span>
</span><span id="line-109"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="hs-pragma">[</span><span class="hs-pragma">0</span><span class="hs-pragma">]</span><span> </span><span class="annot"><a href="Data.Text.Internal.Encoding.Fusion.html#streamUtf16LE"><span class="hs-pragma hs-type">streamUtf16LE</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-110"></span><span>
</span><span id="line-111"></span><span class="hs-comment">-- | /O(n)/ Convert a 'ByteString' into a 'Stream Char', using big</span><span>
</span><span id="line-112"></span><span class="hs-comment">-- endian UTF-16 encoding.</span><span>
</span><span id="line-113"></span><span class="annot"><a href="Data.Text.Internal.Encoding.Fusion.html#streamUtf16BE"><span class="hs-identifier hs-type">streamUtf16BE</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Data.Text.Encoding.Error.html#OnDecodeError"><span class="hs-identifier hs-type">OnDecodeError</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../bytestring/src/Data.ByteString.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Text.Internal.Fusion.Types.html#Stream"><span class="hs-identifier hs-type">Stream</span></a></span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Char"><span class="hs-identifier hs-type">Char</span></a></span><span>
</span><span id="line-114"></span><span id="streamUtf16BE"><span class="annot"><span class="annottext">streamUtf16BE :: OnDecodeError -&gt; ByteString -&gt; Stream Char
</span><a href="Data.Text.Internal.Encoding.Fusion.html#streamUtf16BE"><span class="hs-identifier hs-var hs-var">streamUtf16BE</span></a></span></span><span> </span><span id="local-6989586621679108616"><span class="annot"><span class="annottext">OnDecodeError
</span><a href="#local-6989586621679108616"><span class="hs-identifier hs-var">onErr</span></a></span></span><span> </span><span id="local-6989586621679108615"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679108615"><span class="hs-identifier hs-var">bs</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Int -&gt; Step Int Char) -&gt; Int -&gt; Size -&gt; Stream Char
forall a s. (s -&gt; Step s a) -&gt; s -&gt; Size -&gt; Stream a
</span><a href="Data.Text.Internal.Fusion.Types.html#Stream"><span class="hs-identifier hs-var">Stream</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Step Int Char
</span><a href="#local-6989586621679108614"><span class="hs-identifier hs-var">next</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int -&gt; Size
</span><a href="Data.Text.Internal.Fusion.Size.html#maxSize"><span class="hs-identifier hs-var">maxSize</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679108613"><span class="hs-identifier hs-var">l</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. UnsafeShift a =&gt; a -&gt; Int -&gt; a
</span><a href="Data.Text.Internal.Unsafe.Shift.html#shiftR"><span class="hs-operator hs-var">`shiftR`</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-115"></span><span>    </span><span class="hs-keyword">where</span><span>
</span><span id="line-116"></span><span>      </span><span id="local-6989586621679108613"><span class="annot"><span class="annottext">l :: Int
</span><a href="#local-6989586621679108613"><span class="hs-identifier hs-var hs-var">l</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; Int
</span><a href="../../bytestring/src/Data.ByteString.html#length"><span class="hs-identifier hs-var">B.length</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679108615"><span class="hs-identifier hs-var">bs</span></a></span><span>
</span><span id="line-117"></span><span>      </span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="#local-6989586621679108614"><span class="hs-pragma hs-type">next</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-118"></span><span>      </span><span id="local-6989586621679108614"><span class="annot"><span class="annottext">next :: Int -&gt; Step Int Char
</span><a href="#local-6989586621679108614"><span class="hs-identifier hs-var hs-var">next</span></a></span></span><span> </span><span id="local-6989586621679108599"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679108599"><span class="hs-identifier hs-var">i</span></a></span></span><span>
</span><span id="line-119"></span><span>          </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679108599"><span class="hs-identifier hs-var">i</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3E%3D"><span class="hs-operator hs-var">&gt;=</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679108613"><span class="hs-identifier hs-var">l</span></a></span><span>                         </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Step Int Char
forall s a. Step s a
</span><a href="Data.Text.Internal.Fusion.Types.html#Done"><span class="hs-identifier hs-var">Done</span></a></span><span>
</span><span id="line-120"></span><span>          </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679108599"><span class="hs-identifier hs-var">i</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3C"><span class="hs-operator hs-var">&lt;</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679108613"><span class="hs-identifier hs-var">l</span></a></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%26%26"><span class="hs-operator hs-var">&amp;&amp;</span></a></span><span> </span><span class="annot"><span class="annottext">Word16 -&gt; Bool
</span><a href="Data.Text.Internal.Encoding.Utf16.html#validate1"><span class="hs-identifier hs-var">U16.validate1</span></a></span><span> </span><span class="annot"><span class="annottext">Word16
</span><a href="#local-6989586621679108598"><span class="hs-identifier hs-var">x1</span></a></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Char -&gt; Int -&gt; Step Int Char
forall s a. a -&gt; s -&gt; Step s a
</span><a href="Data.Text.Internal.Fusion.Types.html#Yield"><span class="hs-identifier hs-var">Yield</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Word16 -&gt; Char
</span><a href="Data.Text.Internal.Unsafe.Char.html#unsafeChr"><span class="hs-identifier hs-var">unsafeChr</span></a></span><span> </span><span class="annot"><span class="annottext">Word16
</span><a href="#local-6989586621679108598"><span class="hs-identifier hs-var">x1</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679108599"><span class="hs-identifier hs-var">i</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">2</span></span><span class="hs-special">)</span><span>
</span><span id="line-121"></span><span>          </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679108599"><span class="hs-identifier hs-var">i</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">3</span></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3C"><span class="hs-operator hs-var">&lt;</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679108613"><span class="hs-identifier hs-var">l</span></a></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%26%26"><span class="hs-operator hs-var">&amp;&amp;</span></a></span><span> </span><span class="annot"><span class="annottext">Word16 -&gt; Word16 -&gt; Bool
</span><a href="Data.Text.Internal.Encoding.Utf16.html#validate2"><span class="hs-identifier hs-var">U16.validate2</span></a></span><span> </span><span class="annot"><span class="annottext">Word16
</span><a href="#local-6989586621679108598"><span class="hs-identifier hs-var">x1</span></a></span><span> </span><span class="annot"><span class="annottext">Word16
</span><a href="#local-6989586621679108597"><span class="hs-identifier hs-var">x2</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Char -&gt; Int -&gt; Step Int Char
forall s a. a -&gt; s -&gt; Step s a
</span><a href="Data.Text.Internal.Fusion.Types.html#Yield"><span class="hs-identifier hs-var">Yield</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Word16 -&gt; Word16 -&gt; Char
</span><a href="Data.Text.Internal.Encoding.Utf16.html#chr2"><span class="hs-identifier hs-var">U16.chr2</span></a></span><span> </span><span class="annot"><span class="annottext">Word16
</span><a href="#local-6989586621679108598"><span class="hs-identifier hs-var">x1</span></a></span><span> </span><span class="annot"><span class="annottext">Word16
</span><a href="#local-6989586621679108597"><span class="hs-identifier hs-var">x2</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679108599"><span class="hs-identifier hs-var">i</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">4</span></span><span class="hs-special">)</span><span>
</span><span id="line-122"></span><span>          </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String
-&gt; String -&gt; OnDecodeError -&gt; Maybe Word8 -&gt; Int -&gt; Step Int Char
forall s.
String
-&gt; String -&gt; OnDecodeError -&gt; Maybe Word8 -&gt; s -&gt; Step s Char
</span><a href="Data.Text.Internal.Encoding.Fusion.html#decodeError"><span class="hs-identifier hs-var">decodeError</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;streamUtf16BE&quot;</span></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;UTF-16BE&quot;</span></span><span> </span><span class="annot"><span class="annottext">OnDecodeError
</span><a href="#local-6989586621679108616"><span class="hs-identifier hs-var">onErr</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe Word8
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679108599"><span class="hs-identifier hs-var">i</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span class="hs-special">)</span><span>
</span><span id="line-123"></span><span>          </span><span class="hs-keyword">where</span><span>
</span><span id="line-124"></span><span>            </span><span id="local-6989586621679108598"><span class="annot"><span class="annottext">x1 :: Word16
</span><a href="#local-6989586621679108598"><span class="hs-identifier hs-var hs-var">x1</span></a></span></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int -&gt; Word16
</span><a href="#local-6989586621679108592"><span class="hs-identifier hs-var">idx</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679108599"><span class="hs-identifier hs-var">i</span></a></span><span> </span><span class="annot"><span class="annottext">Word16 -&gt; Int -&gt; Word16
forall a. UnsafeShift a =&gt; a -&gt; Int -&gt; a
</span><a href="Data.Text.Internal.Unsafe.Shift.html#shiftL"><span class="hs-operator hs-var">`shiftL`</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">8</span></span><span class="hs-special">)</span><span>       </span><span class="annot"><span class="annottext">Word16 -&gt; Word16 -&gt; Word16
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Word16
</span><a href="#local-6989586621679108592"><span class="hs-identifier hs-var">idx</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679108599"><span class="hs-identifier hs-var">i</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span class="hs-special">)</span><span>
</span><span id="line-125"></span><span>            </span><span id="local-6989586621679108597"><span class="annot"><span class="annottext">x2 :: Word16
</span><a href="#local-6989586621679108597"><span class="hs-identifier hs-var hs-var">x2</span></a></span></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int -&gt; Word16
</span><a href="#local-6989586621679108592"><span class="hs-identifier hs-var">idx</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679108599"><span class="hs-identifier hs-var">i</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">2</span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Word16 -&gt; Int -&gt; Word16
forall a. UnsafeShift a =&gt; a -&gt; Int -&gt; a
</span><a href="Data.Text.Internal.Unsafe.Shift.html#shiftL"><span class="hs-operator hs-var">`shiftL`</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">8</span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Word16 -&gt; Word16 -&gt; Word16
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Word16
</span><a href="#local-6989586621679108592"><span class="hs-identifier hs-var">idx</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679108599"><span class="hs-identifier hs-var">i</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">3</span></span><span class="hs-special">)</span><span>
</span><span id="line-126"></span><span>            </span><span id="local-6989586621679108592"><span class="annot"><span class="annottext">idx :: Int -&gt; Word16
</span><a href="#local-6989586621679108592"><span class="hs-identifier hs-var hs-var">idx</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Word8 -&gt; Word16
</span><a href="Data.Text.Internal.Encoding.Fusion.html#word8ToWord16"><span class="hs-identifier hs-var">word8ToWord16</span></a></span><span> </span><span class="annot"><span class="annottext">(Word8 -&gt; Word16) -&gt; (Int -&gt; Word8) -&gt; Int -&gt; Word16
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; Int -&gt; Word8
</span><a href="../../bytestring/src/Data.ByteString.Unsafe.html#unsafeIndex"><span class="hs-identifier hs-var">B.unsafeIndex</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679108615"><span class="hs-identifier hs-var">bs</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-identifier hs-type">Int</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Word.html#Word16"><span class="hs-identifier hs-type">Word16</span></a></span><span>
</span><span id="line-127"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="hs-pragma">[</span><span class="hs-pragma">0</span><span class="hs-pragma">]</span><span> </span><span class="annot"><a href="Data.Text.Internal.Encoding.Fusion.html#streamUtf16BE"><span class="hs-pragma hs-type">streamUtf16BE</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-128"></span><span>
</span><span id="line-129"></span><span class="hs-comment">-- | /O(n)/ Convert a 'ByteString' into a 'Stream Char', using big</span><span>
</span><span id="line-130"></span><span class="hs-comment">-- endian UTF-32 encoding.</span><span>
</span><span id="line-131"></span><span class="annot"><a href="Data.Text.Internal.Encoding.Fusion.html#streamUtf32BE"><span class="hs-identifier hs-type">streamUtf32BE</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Data.Text.Encoding.Error.html#OnDecodeError"><span class="hs-identifier hs-type">OnDecodeError</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../bytestring/src/Data.ByteString.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Text.Internal.Fusion.Types.html#Stream"><span class="hs-identifier hs-type">Stream</span></a></span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Char"><span class="hs-identifier hs-type">Char</span></a></span><span>
</span><span id="line-132"></span><span id="streamUtf32BE"><span class="annot"><span class="annottext">streamUtf32BE :: OnDecodeError -&gt; ByteString -&gt; Stream Char
</span><a href="Data.Text.Internal.Encoding.Fusion.html#streamUtf32BE"><span class="hs-identifier hs-var hs-var">streamUtf32BE</span></a></span></span><span> </span><span id="local-6989586621679108585"><span class="annot"><span class="annottext">OnDecodeError
</span><a href="#local-6989586621679108585"><span class="hs-identifier hs-var">onErr</span></a></span></span><span> </span><span id="local-6989586621679108584"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679108584"><span class="hs-identifier hs-var">bs</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Int -&gt; Step Int Char) -&gt; Int -&gt; Size -&gt; Stream Char
forall a s. (s -&gt; Step s a) -&gt; s -&gt; Size -&gt; Stream a
</span><a href="Data.Text.Internal.Fusion.Types.html#Stream"><span class="hs-identifier hs-var">Stream</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Step Int Char
</span><a href="#local-6989586621679108583"><span class="hs-identifier hs-var">next</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int -&gt; Size
</span><a href="Data.Text.Internal.Fusion.Size.html#maxSize"><span class="hs-identifier hs-var">maxSize</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679108582"><span class="hs-identifier hs-var">l</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. UnsafeShift a =&gt; a -&gt; Int -&gt; a
</span><a href="Data.Text.Internal.Unsafe.Shift.html#shiftR"><span class="hs-operator hs-var">`shiftR`</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">2</span></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-133"></span><span>    </span><span class="hs-keyword">where</span><span>
</span><span id="line-134"></span><span>      </span><span id="local-6989586621679108582"><span class="annot"><span class="annottext">l :: Int
</span><a href="#local-6989586621679108582"><span class="hs-identifier hs-var hs-var">l</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; Int
</span><a href="../../bytestring/src/Data.ByteString.html#length"><span class="hs-identifier hs-var">B.length</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679108584"><span class="hs-identifier hs-var">bs</span></a></span><span>
</span><span id="line-135"></span><span>      </span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="#local-6989586621679108583"><span class="hs-pragma hs-type">next</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-136"></span><span>      </span><span id="local-6989586621679108583"><span class="annot"><span class="annottext">next :: Int -&gt; Step Int Char
</span><a href="#local-6989586621679108583"><span class="hs-identifier hs-var hs-var">next</span></a></span></span><span> </span><span id="local-6989586621679108573"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679108573"><span class="hs-identifier hs-var">i</span></a></span></span><span>
</span><span id="line-137"></span><span>          </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679108573"><span class="hs-identifier hs-var">i</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3E%3D"><span class="hs-operator hs-var">&gt;=</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679108582"><span class="hs-identifier hs-var">l</span></a></span><span>                    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Step Int Char
forall s a. Step s a
</span><a href="Data.Text.Internal.Fusion.Types.html#Done"><span class="hs-identifier hs-var">Done</span></a></span><span>
</span><span id="line-138"></span><span>          </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679108573"><span class="hs-identifier hs-var">i</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">3</span></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3C"><span class="hs-operator hs-var">&lt;</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679108582"><span class="hs-identifier hs-var">l</span></a></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%26%26"><span class="hs-operator hs-var">&amp;&amp;</span></a></span><span> </span><span class="annot"><span class="annottext">Word32 -&gt; Bool
</span><a href="Data.Text.Internal.Encoding.Utf32.html#validate"><span class="hs-identifier hs-var">U32.validate</span></a></span><span> </span><span class="annot"><span class="annottext">Word32
</span><a href="#local-6989586621679108571"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Char -&gt; Int -&gt; Step Int Char
forall s a. a -&gt; s -&gt; Step s a
</span><a href="Data.Text.Internal.Fusion.Types.html#Yield"><span class="hs-identifier hs-var">Yield</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Word32 -&gt; Char
</span><a href="Data.Text.Internal.Unsafe.Char.html#unsafeChr32"><span class="hs-identifier hs-var">unsafeChr32</span></a></span><span> </span><span class="annot"><span class="annottext">Word32
</span><a href="#local-6989586621679108571"><span class="hs-identifier hs-var">x</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679108573"><span class="hs-identifier hs-var">i</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">4</span></span><span class="hs-special">)</span><span>
</span><span id="line-139"></span><span>          </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String
-&gt; String -&gt; OnDecodeError -&gt; Maybe Word8 -&gt; Int -&gt; Step Int Char
forall s.
String
-&gt; String -&gt; OnDecodeError -&gt; Maybe Word8 -&gt; s -&gt; Step s Char
</span><a href="Data.Text.Internal.Encoding.Fusion.html#decodeError"><span class="hs-identifier hs-var">decodeError</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;streamUtf32BE&quot;</span></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;UTF-32BE&quot;</span></span><span> </span><span class="annot"><span class="annottext">OnDecodeError
</span><a href="#local-6989586621679108585"><span class="hs-identifier hs-var">onErr</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe Word8
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679108573"><span class="hs-identifier hs-var">i</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span class="hs-special">)</span><span>
</span><span id="line-140"></span><span>          </span><span class="hs-keyword">where</span><span>
</span><span id="line-141"></span><span>            </span><span id="local-6989586621679108571"><span class="annot"><span class="annottext">x :: Word32
</span><a href="#local-6989586621679108571"><span class="hs-identifier hs-var hs-var">x</span></a></span></span><span>     </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Word32 -&gt; Int -&gt; Word32
forall a. UnsafeShift a =&gt; a -&gt; Int -&gt; a
</span><a href="Data.Text.Internal.Unsafe.Shift.html#shiftL"><span class="hs-identifier hs-var">shiftL</span></a></span><span> </span><span class="annot"><span class="annottext">Word32
</span><a href="#local-6989586621679108563"><span class="hs-identifier hs-var">x1</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">24</span></span><span> </span><span class="annot"><span class="annottext">Word32 -&gt; Word32 -&gt; Word32
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span> </span><span class="annot"><span class="annottext">Word32 -&gt; Int -&gt; Word32
forall a. UnsafeShift a =&gt; a -&gt; Int -&gt; a
</span><a href="Data.Text.Internal.Unsafe.Shift.html#shiftL"><span class="hs-identifier hs-var">shiftL</span></a></span><span> </span><span class="annot"><span class="annottext">Word32
</span><a href="#local-6989586621679108562"><span class="hs-identifier hs-var">x2</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">16</span></span><span> </span><span class="annot"><span class="annottext">Word32 -&gt; Word32 -&gt; Word32
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span> </span><span class="annot"><span class="annottext">Word32 -&gt; Int -&gt; Word32
forall a. UnsafeShift a =&gt; a -&gt; Int -&gt; a
</span><a href="Data.Text.Internal.Unsafe.Shift.html#shiftL"><span class="hs-identifier hs-var">shiftL</span></a></span><span> </span><span class="annot"><span class="annottext">Word32
</span><a href="#local-6989586621679108561"><span class="hs-identifier hs-var">x3</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">8</span></span><span> </span><span class="annot"><span class="annottext">Word32 -&gt; Word32 -&gt; Word32
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span> </span><span class="annot"><span class="annottext">Word32
</span><a href="#local-6989586621679108560"><span class="hs-identifier hs-var">x4</span></a></span><span>
</span><span id="line-142"></span><span>            </span><span id="local-6989586621679108563"><span class="annot"><span class="annottext">x1 :: Word32
</span><a href="#local-6989586621679108563"><span class="hs-identifier hs-var hs-var">x1</span></a></span></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int -&gt; Word32
</span><a href="#local-6989586621679108559"><span class="hs-identifier hs-var">idx</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679108573"><span class="hs-identifier hs-var">i</span></a></span><span>
</span><span id="line-143"></span><span>            </span><span id="local-6989586621679108562"><span class="annot"><span class="annottext">x2 :: Word32
</span><a href="#local-6989586621679108562"><span class="hs-identifier hs-var hs-var">x2</span></a></span></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int -&gt; Word32
</span><a href="#local-6989586621679108559"><span class="hs-identifier hs-var">idx</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679108573"><span class="hs-identifier hs-var">i</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span class="hs-special">)</span><span>
</span><span id="line-144"></span><span>            </span><span id="local-6989586621679108561"><span class="annot"><span class="annottext">x3 :: Word32
</span><a href="#local-6989586621679108561"><span class="hs-identifier hs-var hs-var">x3</span></a></span></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int -&gt; Word32
</span><a href="#local-6989586621679108559"><span class="hs-identifier hs-var">idx</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679108573"><span class="hs-identifier hs-var">i</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">2</span></span><span class="hs-special">)</span><span>
</span><span id="line-145"></span><span>            </span><span id="local-6989586621679108560"><span class="annot"><span class="annottext">x4 :: Word32
</span><a href="#local-6989586621679108560"><span class="hs-identifier hs-var hs-var">x4</span></a></span></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int -&gt; Word32
</span><a href="#local-6989586621679108559"><span class="hs-identifier hs-var">idx</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679108573"><span class="hs-identifier hs-var">i</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">3</span></span><span class="hs-special">)</span><span>
</span><span id="line-146"></span><span>            </span><span id="local-6989586621679108559"><span class="annot"><span class="annottext">idx :: Int -&gt; Word32
</span><a href="#local-6989586621679108559"><span class="hs-identifier hs-var hs-var">idx</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Word8 -&gt; Word32
</span><a href="Data.Text.Internal.Encoding.Fusion.html#word8ToWord32"><span class="hs-identifier hs-var">word8ToWord32</span></a></span><span> </span><span class="annot"><span class="annottext">(Word8 -&gt; Word32) -&gt; (Int -&gt; Word8) -&gt; Int -&gt; Word32
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; Int -&gt; Word8
</span><a href="../../bytestring/src/Data.ByteString.Unsafe.html#unsafeIndex"><span class="hs-identifier hs-var">B.unsafeIndex</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679108584"><span class="hs-identifier hs-var">bs</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-identifier hs-type">Int</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Word.html#Word32"><span class="hs-identifier hs-type">Word32</span></a></span><span>
</span><span id="line-147"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="hs-pragma">[</span><span class="hs-pragma">0</span><span class="hs-pragma">]</span><span> </span><span class="annot"><a href="Data.Text.Internal.Encoding.Fusion.html#streamUtf32BE"><span class="hs-pragma hs-type">streamUtf32BE</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-148"></span><span>
</span><span id="line-149"></span><span class="hs-comment">-- | /O(n)/ Convert a 'ByteString' into a 'Stream Char', using little</span><span>
</span><span id="line-150"></span><span class="hs-comment">-- endian UTF-32 encoding.</span><span>
</span><span id="line-151"></span><span class="annot"><a href="Data.Text.Internal.Encoding.Fusion.html#streamUtf32LE"><span class="hs-identifier hs-type">streamUtf32LE</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Data.Text.Encoding.Error.html#OnDecodeError"><span class="hs-identifier hs-type">OnDecodeError</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../bytestring/src/Data.ByteString.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Text.Internal.Fusion.Types.html#Stream"><span class="hs-identifier hs-type">Stream</span></a></span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Char"><span class="hs-identifier hs-type">Char</span></a></span><span>
</span><span id="line-152"></span><span id="streamUtf32LE"><span class="annot"><span class="annottext">streamUtf32LE :: OnDecodeError -&gt; ByteString -&gt; Stream Char
</span><a href="Data.Text.Internal.Encoding.Fusion.html#streamUtf32LE"><span class="hs-identifier hs-var hs-var">streamUtf32LE</span></a></span></span><span> </span><span id="local-6989586621679108551"><span class="annot"><span class="annottext">OnDecodeError
</span><a href="#local-6989586621679108551"><span class="hs-identifier hs-var">onErr</span></a></span></span><span> </span><span id="local-6989586621679108550"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679108550"><span class="hs-identifier hs-var">bs</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Int -&gt; Step Int Char) -&gt; Int -&gt; Size -&gt; Stream Char
forall a s. (s -&gt; Step s a) -&gt; s -&gt; Size -&gt; Stream a
</span><a href="Data.Text.Internal.Fusion.Types.html#Stream"><span class="hs-identifier hs-var">Stream</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Step Int Char
</span><a href="#local-6989586621679108549"><span class="hs-identifier hs-var">next</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int -&gt; Size
</span><a href="Data.Text.Internal.Fusion.Size.html#maxSize"><span class="hs-identifier hs-var">maxSize</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679108548"><span class="hs-identifier hs-var">l</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. UnsafeShift a =&gt; a -&gt; Int -&gt; a
</span><a href="Data.Text.Internal.Unsafe.Shift.html#shiftR"><span class="hs-operator hs-var">`shiftR`</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">2</span></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-153"></span><span>    </span><span class="hs-keyword">where</span><span>
</span><span id="line-154"></span><span>      </span><span id="local-6989586621679108548"><span class="annot"><span class="annottext">l :: Int
</span><a href="#local-6989586621679108548"><span class="hs-identifier hs-var hs-var">l</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; Int
</span><a href="../../bytestring/src/Data.ByteString.html#length"><span class="hs-identifier hs-var">B.length</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679108550"><span class="hs-identifier hs-var">bs</span></a></span><span>
</span><span id="line-155"></span><span>      </span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="#local-6989586621679108549"><span class="hs-pragma hs-type">next</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-156"></span><span>      </span><span id="local-6989586621679108549"><span class="annot"><span class="annottext">next :: Int -&gt; Step Int Char
</span><a href="#local-6989586621679108549"><span class="hs-identifier hs-var hs-var">next</span></a></span></span><span> </span><span id="local-6989586621679108539"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679108539"><span class="hs-identifier hs-var">i</span></a></span></span><span>
</span><span id="line-157"></span><span>          </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679108539"><span class="hs-identifier hs-var">i</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3E%3D"><span class="hs-operator hs-var">&gt;=</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679108548"><span class="hs-identifier hs-var">l</span></a></span><span>                    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Step Int Char
forall s a. Step s a
</span><a href="Data.Text.Internal.Fusion.Types.html#Done"><span class="hs-identifier hs-var">Done</span></a></span><span>
</span><span id="line-158"></span><span>          </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679108539"><span class="hs-identifier hs-var">i</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">3</span></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3C"><span class="hs-operator hs-var">&lt;</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679108548"><span class="hs-identifier hs-var">l</span></a></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%26%26"><span class="hs-operator hs-var">&amp;&amp;</span></a></span><span> </span><span class="annot"><span class="annottext">Word32 -&gt; Bool
</span><a href="Data.Text.Internal.Encoding.Utf32.html#validate"><span class="hs-identifier hs-var">U32.validate</span></a></span><span> </span><span class="annot"><span class="annottext">Word32
</span><a href="#local-6989586621679108538"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Char -&gt; Int -&gt; Step Int Char
forall s a. a -&gt; s -&gt; Step s a
</span><a href="Data.Text.Internal.Fusion.Types.html#Yield"><span class="hs-identifier hs-var">Yield</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Word32 -&gt; Char
</span><a href="Data.Text.Internal.Unsafe.Char.html#unsafeChr32"><span class="hs-identifier hs-var">unsafeChr32</span></a></span><span> </span><span class="annot"><span class="annottext">Word32
</span><a href="#local-6989586621679108538"><span class="hs-identifier hs-var">x</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679108539"><span class="hs-identifier hs-var">i</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">4</span></span><span class="hs-special">)</span><span>
</span><span id="line-159"></span><span>          </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String
-&gt; String -&gt; OnDecodeError -&gt; Maybe Word8 -&gt; Int -&gt; Step Int Char
forall s.
String
-&gt; String -&gt; OnDecodeError -&gt; Maybe Word8 -&gt; s -&gt; Step s Char
</span><a href="Data.Text.Internal.Encoding.Fusion.html#decodeError"><span class="hs-identifier hs-var">decodeError</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;streamUtf32LE&quot;</span></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;UTF-32LE&quot;</span></span><span> </span><span class="annot"><span class="annottext">OnDecodeError
</span><a href="#local-6989586621679108551"><span class="hs-identifier hs-var">onErr</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe Word8
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679108539"><span class="hs-identifier hs-var">i</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span class="hs-special">)</span><span>
</span><span id="line-160"></span><span>          </span><span class="hs-keyword">where</span><span>
</span><span id="line-161"></span><span>            </span><span id="local-6989586621679108538"><span class="annot"><span class="annottext">x :: Word32
</span><a href="#local-6989586621679108538"><span class="hs-identifier hs-var hs-var">x</span></a></span></span><span>     </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Word32 -&gt; Int -&gt; Word32
forall a. UnsafeShift a =&gt; a -&gt; Int -&gt; a
</span><a href="Data.Text.Internal.Unsafe.Shift.html#shiftL"><span class="hs-identifier hs-var">shiftL</span></a></span><span> </span><span class="annot"><span class="annottext">Word32
</span><a href="#local-6989586621679108531"><span class="hs-identifier hs-var">x4</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">24</span></span><span> </span><span class="annot"><span class="annottext">Word32 -&gt; Word32 -&gt; Word32
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span> </span><span class="annot"><span class="annottext">Word32 -&gt; Int -&gt; Word32
forall a. UnsafeShift a =&gt; a -&gt; Int -&gt; a
</span><a href="Data.Text.Internal.Unsafe.Shift.html#shiftL"><span class="hs-identifier hs-var">shiftL</span></a></span><span> </span><span class="annot"><span class="annottext">Word32
</span><a href="#local-6989586621679108530"><span class="hs-identifier hs-var">x3</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">16</span></span><span> </span><span class="annot"><span class="annottext">Word32 -&gt; Word32 -&gt; Word32
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span> </span><span class="annot"><span class="annottext">Word32 -&gt; Int -&gt; Word32
forall a. UnsafeShift a =&gt; a -&gt; Int -&gt; a
</span><a href="Data.Text.Internal.Unsafe.Shift.html#shiftL"><span class="hs-identifier hs-var">shiftL</span></a></span><span> </span><span class="annot"><span class="annottext">Word32
</span><a href="#local-6989586621679108529"><span class="hs-identifier hs-var">x2</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">8</span></span><span> </span><span class="annot"><span class="annottext">Word32 -&gt; Word32 -&gt; Word32
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span> </span><span class="annot"><span class="annottext">Word32
</span><a href="#local-6989586621679108528"><span class="hs-identifier hs-var">x1</span></a></span><span>
</span><span id="line-162"></span><span>            </span><span id="local-6989586621679108528"><span class="annot"><span class="annottext">x1 :: Word32
</span><a href="#local-6989586621679108528"><span class="hs-identifier hs-var hs-var">x1</span></a></span></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int -&gt; Word32
</span><a href="#local-6989586621679108527"><span class="hs-identifier hs-var">idx</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679108539"><span class="hs-identifier hs-var">i</span></a></span><span>
</span><span id="line-163"></span><span>            </span><span id="local-6989586621679108529"><span class="annot"><span class="annottext">x2 :: Word32
</span><a href="#local-6989586621679108529"><span class="hs-identifier hs-var hs-var">x2</span></a></span></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int -&gt; Word32
</span><a href="#local-6989586621679108527"><span class="hs-identifier hs-var">idx</span></a></span><span> </span><span class="annot"><span class="annottext">(Int -&gt; Word32) -&gt; Int -&gt; Word32
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679108539"><span class="hs-identifier hs-var">i</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span>
</span><span id="line-164"></span><span>            </span><span id="local-6989586621679108530"><span class="annot"><span class="annottext">x3 :: Word32
</span><a href="#local-6989586621679108530"><span class="hs-identifier hs-var hs-var">x3</span></a></span></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int -&gt; Word32
</span><a href="#local-6989586621679108527"><span class="hs-identifier hs-var">idx</span></a></span><span> </span><span class="annot"><span class="annottext">(Int -&gt; Word32) -&gt; Int -&gt; Word32
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679108539"><span class="hs-identifier hs-var">i</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">2</span></span><span>
</span><span id="line-165"></span><span>            </span><span id="local-6989586621679108531"><span class="annot"><span class="annottext">x4 :: Word32
</span><a href="#local-6989586621679108531"><span class="hs-identifier hs-var hs-var">x4</span></a></span></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int -&gt; Word32
</span><a href="#local-6989586621679108527"><span class="hs-identifier hs-var">idx</span></a></span><span> </span><span class="annot"><span class="annottext">(Int -&gt; Word32) -&gt; Int -&gt; Word32
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679108539"><span class="hs-identifier hs-var">i</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">3</span></span><span>
</span><span id="line-166"></span><span>            </span><span id="local-6989586621679108527"><span class="annot"><span class="annottext">idx :: Int -&gt; Word32
</span><a href="#local-6989586621679108527"><span class="hs-identifier hs-var hs-var">idx</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Word8 -&gt; Word32
</span><a href="Data.Text.Internal.Encoding.Fusion.html#word8ToWord32"><span class="hs-identifier hs-var">word8ToWord32</span></a></span><span> </span><span class="annot"><span class="annottext">(Word8 -&gt; Word32) -&gt; (Int -&gt; Word8) -&gt; Int -&gt; Word32
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; Int -&gt; Word8
</span><a href="../../bytestring/src/Data.ByteString.Unsafe.html#unsafeIndex"><span class="hs-identifier hs-var">B.unsafeIndex</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679108550"><span class="hs-identifier hs-var">bs</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-identifier hs-type">Int</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Word.html#Word32"><span class="hs-identifier hs-type">Word32</span></a></span><span>
</span><span id="line-167"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="hs-pragma">[</span><span class="hs-pragma">0</span><span class="hs-pragma">]</span><span> </span><span class="annot"><a href="Data.Text.Internal.Encoding.Fusion.html#streamUtf32LE"><span class="hs-pragma hs-type">streamUtf32LE</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-168"></span><span>
</span><span id="line-169"></span><span class="hs-comment">-- | /O(n)/ Convert a 'Stream' 'Word8' to a 'ByteString'.</span><span>
</span><span id="line-170"></span><span class="annot"><a href="Data.Text.Internal.Encoding.Fusion.html#unstream"><span class="hs-identifier hs-type">unstream</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Data.Text.Internal.Fusion.Types.html#Stream"><span class="hs-identifier hs-type">Stream</span></a></span><span> </span><span class="annot"><a href="../../base/src/GHC.Word.html#Word8"><span class="hs-identifier hs-type">Word8</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../bytestring/src/Data.ByteString.Internal.html#ByteString"><span class="hs-identifier hs-type">ByteString</span></a></span><span>
</span><span id="line-171"></span><span id="unstream"><span class="annot"><span class="annottext">unstream :: Stream Word8 -&gt; ByteString
</span><a href="Data.Text.Internal.Encoding.Fusion.html#unstream"><span class="hs-identifier hs-var hs-var">unstream</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.Text.Internal.Fusion.Types.html#Stream"><span class="hs-identifier hs-type">Stream</span></a></span><span> </span><span id="local-6989586621679108515"><span class="annot"><span class="annottext">s -&gt; Step s Word8
</span><a href="#local-6989586621679108515"><span class="hs-identifier hs-var">next</span></a></span></span><span> </span><span id="local-6989586621679108514"><span class="annot"><span class="annottext">s
</span><a href="#local-6989586621679108514"><span class="hs-identifier hs-var">s0</span></a></span></span><span> </span><span id="local-6989586621679108513"><span class="annot"><span class="annottext">Size
</span><a href="#local-6989586621679108513"><span class="hs-identifier hs-var">len</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">IO ByteString -&gt; ByteString
forall a. IO a -&gt; a
</span><a href="../../base/src/GHC.IO.Unsafe.html#unsafeDupablePerformIO"><span class="hs-identifier hs-var">unsafeDupablePerformIO</span></a></span><span> </span><span class="annot"><span class="annottext">(IO ByteString -&gt; ByteString) -&gt; IO ByteString -&gt; ByteString
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-172"></span><span>    </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621679108512"><span class="annot"><span class="annottext">mlen :: Int
</span><a href="#local-6989586621679108512"><span class="hs-identifier hs-var hs-var">mlen</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int -&gt; Size -&gt; Int
</span><a href="Data.Text.Internal.Fusion.Size.html#upperBound"><span class="hs-identifier hs-var">upperBound</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">4</span></span><span> </span><span class="annot"><span class="annottext">Size
</span><a href="#local-6989586621679108513"><span class="hs-identifier hs-var">len</span></a></span><span>
</span><span id="line-173"></span><span>    </span><span class="annot"><span class="annottext">Int -&gt; IO (ForeignPtr Word8)
forall a. Int -&gt; IO (ForeignPtr a)
</span><a href="../../bytestring/src/Data.ByteString.Internal.html#mallocByteString"><span class="hs-identifier hs-var">mallocByteString</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679108512"><span class="hs-identifier hs-var">mlen</span></a></span><span> </span><span class="annot"><span class="annottext">IO (ForeignPtr Word8)
-&gt; (ForeignPtr Word8 -&gt; IO ByteString) -&gt; IO ByteString
forall (m :: * -&gt; *) a b. Monad m =&gt; m a -&gt; (a -&gt; m b) -&gt; m b
</span><a href="../../base/src/GHC.Base.html#%3E%3E%3D"><span class="hs-operator hs-var">&gt;&gt;=</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; s -&gt; ForeignPtr Word8 -&gt; IO ByteString
</span><a href="#local-6989586621679108510"><span class="hs-identifier hs-var">loop</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679108512"><span class="hs-identifier hs-var">mlen</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span> </span><span class="annot"><span class="annottext">s
</span><a href="#local-6989586621679108514"><span class="hs-identifier hs-var">s0</span></a></span><span>
</span><span id="line-174"></span><span>    </span><span class="hs-keyword">where</span><span>
</span><span id="line-175"></span><span>      </span><span id="local-6989586621679108510"><span class="annot"><span class="annottext">loop :: Int -&gt; Int -&gt; s -&gt; ForeignPtr Word8 -&gt; IO ByteString
</span><a href="#local-6989586621679108510"><span class="hs-identifier hs-var hs-var">loop</span></a></span></span><span> </span><span class="hs-glyph">!</span><span id="local-6989586621679108496"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679108496"><span class="hs-identifier hs-var">n</span></a></span></span><span> </span><span class="hs-glyph">!</span><span id="local-6989586621679108495"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679108495"><span class="hs-identifier hs-var">off</span></a></span></span><span> </span><span class="hs-glyph">!</span><span id="local-6989586621679108494"><span class="annot"><span class="annottext">s
</span><a href="#local-6989586621679108494"><span class="hs-identifier hs-var">s</span></a></span></span><span> </span><span id="local-6989586621679108493"><span class="annot"><span class="annottext">ForeignPtr Word8
</span><a href="#local-6989586621679108493"><span class="hs-identifier hs-var">fp</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">s -&gt; Step s Word8
</span><a href="#local-6989586621679108515"><span class="hs-identifier hs-var">next</span></a></span><span> </span><span class="annot"><span class="annottext">s
</span><a href="#local-6989586621679108494"><span class="hs-identifier hs-var">s</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-176"></span><span>          </span><span class="annot"><span class="annottext">Step s Word8
</span><a href="Data.Text.Internal.Fusion.Types.html#Done"><span class="hs-identifier hs-var">Done</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">ForeignPtr Word8 -&gt; Int -&gt; Int -&gt; IO ByteString
forall {m :: * -&gt; *} {p}.
Monad m =&gt;
ForeignPtr Word8 -&gt; p -&gt; Int -&gt; m ByteString
</span><a href="#local-6989586621679108492"><span class="hs-identifier hs-var">trimUp</span></a></span><span> </span><span class="annot"><span class="annottext">ForeignPtr Word8
</span><a href="#local-6989586621679108493"><span class="hs-identifier hs-var">fp</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679108496"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679108495"><span class="hs-identifier hs-var">off</span></a></span><span>
</span><span id="line-177"></span><span>          </span><span class="annot"><a href="Data.Text.Internal.Fusion.Types.html#Skip"><span class="hs-identifier hs-type">Skip</span></a></span><span> </span><span id="local-6989586621679108490"><span class="annot"><span class="annottext">s
</span><a href="#local-6989586621679108490"><span class="hs-identifier hs-var">s'</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; s -&gt; ForeignPtr Word8 -&gt; IO ByteString
</span><a href="#local-6989586621679108510"><span class="hs-identifier hs-var">loop</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679108496"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679108495"><span class="hs-identifier hs-var">off</span></a></span><span> </span><span class="annot"><span class="annottext">s
</span><a href="#local-6989586621679108490"><span class="hs-identifier hs-var">s'</span></a></span><span> </span><span class="annot"><span class="annottext">ForeignPtr Word8
</span><a href="#local-6989586621679108493"><span class="hs-identifier hs-var">fp</span></a></span><span>
</span><span id="line-178"></span><span>          </span><span class="annot"><a href="Data.Text.Internal.Fusion.Types.html#Yield"><span class="hs-identifier hs-type">Yield</span></a></span><span> </span><span id="local-6989586621679108489"><span class="annot"><span class="annottext">Word8
</span><a href="#local-6989586621679108489"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span id="local-6989586621679108488"><span class="annot"><span class="annottext">s
</span><a href="#local-6989586621679108488"><span class="hs-identifier hs-var">s'</span></a></span></span><span>
</span><span id="line-179"></span><span>              </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679108495"><span class="hs-identifier hs-var">off</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3D%3D"><span class="hs-operator hs-var">==</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679108496"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">ForeignPtr Word8 -&gt; Int -&gt; Int -&gt; s -&gt; Word8 -&gt; IO ByteString
</span><a href="#local-6989586621679108487"><span class="hs-identifier hs-var">realloc</span></a></span><span> </span><span class="annot"><span class="annottext">ForeignPtr Word8
</span><a href="#local-6989586621679108493"><span class="hs-identifier hs-var">fp</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679108496"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679108495"><span class="hs-identifier hs-var">off</span></a></span><span> </span><span class="annot"><span class="annottext">s
</span><a href="#local-6989586621679108488"><span class="hs-identifier hs-var">s'</span></a></span><span> </span><span class="annot"><span class="annottext">Word8
</span><a href="#local-6989586621679108489"><span class="hs-identifier hs-var">x</span></a></span><span>
</span><span id="line-180"></span><span>              </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-181"></span><span>            </span><span class="annot"><span class="annottext">ForeignPtr Word8 -&gt; (Ptr Word8 -&gt; IO ()) -&gt; IO ()
forall a b. ForeignPtr a -&gt; (Ptr a -&gt; IO b) -&gt; IO b
</span><a href="Data.Text.Internal.Functions.html#unsafeWithForeignPtr"><span class="hs-identifier hs-var">unsafeWithForeignPtr</span></a></span><span> </span><span class="annot"><span class="annottext">ForeignPtr Word8
</span><a href="#local-6989586621679108493"><span class="hs-identifier hs-var">fp</span></a></span><span> </span><span class="annot"><span class="annottext">((Ptr Word8 -&gt; IO ()) -&gt; IO ()) -&gt; (Ptr Word8 -&gt; IO ()) -&gt; IO ()
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-glyph">\</span><span id="local-6989586621679108486"><span class="annot"><span class="annottext">Ptr Word8
</span><a href="#local-6989586621679108486"><span class="hs-identifier hs-var">p</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Ptr Word8 -&gt; Int -&gt; Word8 -&gt; IO ()
forall a b. Storable a =&gt; Ptr b -&gt; Int -&gt; a -&gt; IO ()
</span><a href="../../base/src/Foreign.Storable.html#pokeByteOff"><span class="hs-identifier hs-var">pokeByteOff</span></a></span><span> </span><span class="annot"><span class="annottext">Ptr Word8
</span><a href="#local-6989586621679108486"><span class="hs-identifier hs-var">p</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679108495"><span class="hs-identifier hs-var">off</span></a></span><span> </span><span class="annot"><span class="annottext">Word8
</span><a href="#local-6989586621679108489"><span class="hs-identifier hs-var">x</span></a></span><span>
</span><span id="line-182"></span><span>            </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; s -&gt; ForeignPtr Word8 -&gt; IO ByteString
</span><a href="#local-6989586621679108510"><span class="hs-identifier hs-var">loop</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679108496"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679108495"><span class="hs-identifier hs-var">off</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">s
</span><a href="#local-6989586621679108488"><span class="hs-identifier hs-var">s'</span></a></span><span> </span><span class="annot"><span class="annottext">ForeignPtr Word8
</span><a href="#local-6989586621679108493"><span class="hs-identifier hs-var">fp</span></a></span><span>
</span><span id="line-183"></span><span>      </span><span class="hs-pragma">{-# NOINLINE</span><span> </span><span class="annot"><a href="#local-6989586621679108487"><span class="hs-pragma hs-type">realloc</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-184"></span><span>      </span><span id="local-6989586621679108487"><span class="annot"><span class="annottext">realloc :: ForeignPtr Word8 -&gt; Int -&gt; Int -&gt; s -&gt; Word8 -&gt; IO ByteString
</span><a href="#local-6989586621679108487"><span class="hs-identifier hs-var hs-var">realloc</span></a></span></span><span> </span><span id="local-6989586621679108485"><span class="annot"><span class="annottext">ForeignPtr Word8
</span><a href="#local-6989586621679108485"><span class="hs-identifier hs-var">fp</span></a></span></span><span> </span><span id="local-6989586621679108484"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679108484"><span class="hs-identifier hs-var">n</span></a></span></span><span> </span><span id="local-6989586621679108483"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679108483"><span class="hs-identifier hs-var">off</span></a></span></span><span> </span><span id="local-6989586621679108482"><span class="annot"><span class="annottext">s
</span><a href="#local-6989586621679108482"><span class="hs-identifier hs-var">s</span></a></span></span><span> </span><span id="local-6989586621679108481"><span class="annot"><span class="annottext">Word8
</span><a href="#local-6989586621679108481"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-185"></span><span>        </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621679108479"><span class="annot"><span class="annottext">n' :: Int
</span><a href="#local-6989586621679108479"><span class="hs-identifier hs-var hs-var">n'</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679108484"><span class="hs-identifier hs-var">n</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679108484"><span class="hs-identifier hs-var">n</span></a></span><span>
</span><span id="line-186"></span><span>        </span><span id="local-6989586621679108478"><span class="annot"><span class="annottext">ForeignPtr Word8
</span><a href="#local-6989586621679108478"><span class="hs-identifier hs-var">fp'</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">ForeignPtr Word8 -&gt; Int -&gt; Int -&gt; IO (ForeignPtr Word8)
</span><a href="#local-6989586621679108477"><span class="hs-identifier hs-var">copy0</span></a></span><span> </span><span class="annot"><span class="annottext">ForeignPtr Word8
</span><a href="#local-6989586621679108485"><span class="hs-identifier hs-var">fp</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679108484"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679108479"><span class="hs-identifier hs-var">n'</span></a></span><span>
</span><span id="line-187"></span><span>        </span><span class="annot"><span class="annottext">ForeignPtr Word8 -&gt; (Ptr Word8 -&gt; IO ()) -&gt; IO ()
forall a b. ForeignPtr a -&gt; (Ptr a -&gt; IO b) -&gt; IO b
</span><a href="Data.Text.Internal.Functions.html#unsafeWithForeignPtr"><span class="hs-identifier hs-var">unsafeWithForeignPtr</span></a></span><span> </span><span class="annot"><span class="annottext">ForeignPtr Word8
</span><a href="#local-6989586621679108478"><span class="hs-identifier hs-var">fp'</span></a></span><span> </span><span class="annot"><span class="annottext">((Ptr Word8 -&gt; IO ()) -&gt; IO ()) -&gt; (Ptr Word8 -&gt; IO ()) -&gt; IO ()
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-glyph">\</span><span id="local-6989586621679108476"><span class="annot"><span class="annottext">Ptr Word8
</span><a href="#local-6989586621679108476"><span class="hs-identifier hs-var">p</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Ptr Word8 -&gt; Int -&gt; Word8 -&gt; IO ()
forall a b. Storable a =&gt; Ptr b -&gt; Int -&gt; a -&gt; IO ()
</span><a href="../../base/src/Foreign.Storable.html#pokeByteOff"><span class="hs-identifier hs-var">pokeByteOff</span></a></span><span> </span><span class="annot"><span class="annottext">Ptr Word8
</span><a href="#local-6989586621679108476"><span class="hs-identifier hs-var">p</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679108483"><span class="hs-identifier hs-var">off</span></a></span><span> </span><span class="annot"><span class="annottext">Word8
</span><a href="#local-6989586621679108481"><span class="hs-identifier hs-var">x</span></a></span><span>
</span><span id="line-188"></span><span>        </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; s -&gt; ForeignPtr Word8 -&gt; IO ByteString
</span><a href="#local-6989586621679108510"><span class="hs-identifier hs-var">loop</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679108479"><span class="hs-identifier hs-var">n'</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679108483"><span class="hs-identifier hs-var">off</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">s
</span><a href="#local-6989586621679108482"><span class="hs-identifier hs-var">s</span></a></span><span> </span><span class="annot"><span class="annottext">ForeignPtr Word8
</span><a href="#local-6989586621679108478"><span class="hs-identifier hs-var">fp'</span></a></span><span>
</span><span id="line-189"></span><span>      </span><span class="hs-pragma">{-# NOINLINE</span><span> </span><span class="annot"><a href="#local-6989586621679108492"><span class="hs-pragma hs-type">trimUp</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-190"></span><span>      </span><span id="local-6989586621679108492"><span class="annot"><span class="annottext">trimUp :: ForeignPtr Word8 -&gt; p -&gt; Int -&gt; m ByteString
</span><a href="#local-6989586621679108492"><span class="hs-identifier hs-var hs-var">trimUp</span></a></span></span><span> </span><span id="local-6989586621679108473"><span class="annot"><span class="annottext">ForeignPtr Word8
</span><a href="#local-6989586621679108473"><span class="hs-identifier hs-var">fp</span></a></span></span><span> </span><span class="annot"><span class="annottext">p
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621679108472"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679108472"><span class="hs-identifier hs-var">off</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; m ByteString
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">(ByteString -&gt; m ByteString) -&gt; ByteString -&gt; m ByteString
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24%21"><span class="hs-operator hs-var">$!</span></a></span><span> </span><span class="annot"><span class="annottext">ForeignPtr Word8 -&gt; Int -&gt; ByteString
</span><a href="Data.Text.Internal.ByteStringCompat.html#mkBS"><span class="hs-identifier hs-var">mkBS</span></a></span><span> </span><span class="annot"><span class="annottext">ForeignPtr Word8
</span><a href="#local-6989586621679108473"><span class="hs-identifier hs-var">fp</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679108472"><span class="hs-identifier hs-var">off</span></a></span><span>
</span><span id="line-191"></span><span>      </span><span class="annot"><a href="#local-6989586621679108477"><span class="hs-identifier hs-type">copy0</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.ForeignPtr.html#ForeignPtr"><span class="hs-identifier hs-type">ForeignPtr</span></a></span><span> </span><span class="annot"><a href="../../base/src/GHC.Word.html#Word8"><span class="hs-identifier hs-type">Word8</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-identifier hs-type">Int</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-identifier hs-type">Int</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#IO"><span class="hs-identifier hs-type">IO</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.ForeignPtr.html#ForeignPtr"><span class="hs-identifier hs-type">ForeignPtr</span></a></span><span> </span><span class="annot"><a href="../../base/src/GHC.Word.html#Word8"><span class="hs-identifier hs-type">Word8</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-192"></span><span>      </span><span id="local-6989586621679108477"><span class="annot"><span class="annottext">copy0 :: ForeignPtr Word8 -&gt; Int -&gt; Int -&gt; IO (ForeignPtr Word8)
</span><a href="#local-6989586621679108477"><span class="hs-identifier hs-var hs-var">copy0</span></a></span></span><span> </span><span class="hs-glyph">!</span><span id="local-6989586621679108469"><span class="annot"><span class="annottext">ForeignPtr Word8
</span><a href="#local-6989586621679108469"><span class="hs-identifier hs-var">src</span></a></span></span><span> </span><span class="hs-glyph">!</span><span id="local-6989586621679108468"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679108468"><span class="hs-identifier hs-var">srcLen</span></a></span></span><span> </span><span class="hs-glyph">!</span><span id="local-6989586621679108467"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679108467"><span class="hs-identifier hs-var">destLen</span></a></span></span><span> </span><span class="hs-glyph">=</span><span class="hs-cpp">
#if defined(ASSERTS)
</span><span>        </span><span class="hs-identifier">assert</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">srcLen</span><span> </span><span class="hs-operator">&lt;=</span><span> </span><span class="hs-identifier">destLen</span><span class="hs-special">)</span><span> </span><span class="hs-operator">$</span><span class="hs-cpp">
#endif
</span><span>        </span><span class="hs-keyword">do</span><span>
</span><span id="line-197"></span><span>          </span><span id="local-6989586621679108466"><span class="annot"><span class="annottext">ForeignPtr Word8
</span><a href="#local-6989586621679108466"><span class="hs-identifier hs-var">dest</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Int -&gt; IO (ForeignPtr Word8)
forall a. Int -&gt; IO (ForeignPtr a)
</span><a href="../../bytestring/src/Data.ByteString.Internal.html#mallocByteString"><span class="hs-identifier hs-var">mallocByteString</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679108467"><span class="hs-identifier hs-var">destLen</span></a></span><span>
</span><span id="line-198"></span><span>          </span><span class="annot"><span class="annottext">ForeignPtr Word8 -&gt; (Ptr Word8 -&gt; IO ()) -&gt; IO ()
forall a b. ForeignPtr a -&gt; (Ptr a -&gt; IO b) -&gt; IO b
</span><a href="Data.Text.Internal.Functions.html#unsafeWithForeignPtr"><span class="hs-identifier hs-var">unsafeWithForeignPtr</span></a></span><span> </span><span class="annot"><span class="annottext">ForeignPtr Word8
</span><a href="#local-6989586621679108469"><span class="hs-identifier hs-var">src</span></a></span><span>  </span><span class="annot"><span class="annottext">((Ptr Word8 -&gt; IO ()) -&gt; IO ()) -&gt; (Ptr Word8 -&gt; IO ()) -&gt; IO ()
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-glyph">\</span><span id="local-6989586621679108465"><span class="annot"><span class="annottext">Ptr Word8
</span><a href="#local-6989586621679108465"><span class="hs-identifier hs-var">src'</span></a></span></span><span>  </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-199"></span><span>              </span><span class="annot"><span class="annottext">ForeignPtr Word8 -&gt; (Ptr Word8 -&gt; IO ()) -&gt; IO ()
forall a b. ForeignPtr a -&gt; (Ptr a -&gt; IO b) -&gt; IO b
</span><a href="Data.Text.Internal.Functions.html#unsafeWithForeignPtr"><span class="hs-identifier hs-var">unsafeWithForeignPtr</span></a></span><span> </span><span class="annot"><span class="annottext">ForeignPtr Word8
</span><a href="#local-6989586621679108466"><span class="hs-identifier hs-var">dest</span></a></span><span> </span><span class="annot"><span class="annottext">((Ptr Word8 -&gt; IO ()) -&gt; IO ()) -&gt; (Ptr Word8 -&gt; IO ()) -&gt; IO ()
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-glyph">\</span><span id="local-6989586621679108464"><span class="annot"><span class="annottext">Ptr Word8
</span><a href="#local-6989586621679108464"><span class="hs-identifier hs-var">dest'</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-200"></span><span>                  </span><span class="annot"><span class="annottext">Ptr Word8 -&gt; Ptr Word8 -&gt; Int -&gt; IO ()
</span><a href="../../bytestring/src/Data.ByteString.Internal.html#memcpy"><span class="hs-identifier hs-var">memcpy</span></a></span><span> </span><span class="annot"><span class="annottext">Ptr Word8
</span><a href="#local-6989586621679108464"><span class="hs-identifier hs-var">dest'</span></a></span><span> </span><span class="annot"><span class="annottext">Ptr Word8
</span><a href="#local-6989586621679108465"><span class="hs-identifier hs-var">src'</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679108468"><span class="hs-identifier hs-var">srcLen</span></a></span><span>
</span><span id="line-201"></span><span>          </span><span class="annot"><span class="annottext">ForeignPtr Word8 -&gt; IO (ForeignPtr Word8)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">ForeignPtr Word8
</span><a href="#local-6989586621679108466"><span class="hs-identifier hs-var">dest</span></a></span><span>
</span><span id="line-202"></span><span>
</span><span id="line-203"></span><span class="annot"><a href="Data.Text.Internal.Encoding.Fusion.html#decodeError"><span class="hs-identifier hs-type">decodeError</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-keyword">forall</span><span> </span><span id="local-6989586621679108780"><span class="annot"><a href="#local-6989586621679108780"><span class="hs-identifier hs-type">s</span></a></span></span><span class="hs-operator">.</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Text.Encoding.Error.html#OnDecodeError"><span class="hs-identifier hs-type">OnDecodeError</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="../../base/src/GHC.Word.html#Word8"><span class="hs-identifier hs-type">Word8</span></a></span><span>
</span><span id="line-204"></span><span>            </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679108780"><span class="hs-identifier hs-type">s</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Text.Internal.Fusion.Types.html#Step"><span class="hs-identifier hs-type">Step</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679108780"><span class="hs-identifier hs-type">s</span></a></span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Char"><span class="hs-identifier hs-type">Char</span></a></span><span>
</span><span id="line-205"></span><span id="decodeError"><span class="annot"><span class="annottext">decodeError :: forall s.
String
-&gt; String -&gt; OnDecodeError -&gt; Maybe Word8 -&gt; s -&gt; Step s Char
</span><a href="Data.Text.Internal.Encoding.Fusion.html#decodeError"><span class="hs-identifier hs-var hs-var">decodeError</span></a></span></span><span> </span><span id="local-6989586621679108463"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679108463"><span class="hs-identifier hs-var">func</span></a></span></span><span> </span><span id="local-6989586621679108462"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679108462"><span class="hs-identifier hs-var">kind</span></a></span></span><span> </span><span id="local-6989586621679108461"><span class="annot"><span class="annottext">OnDecodeError
</span><a href="#local-6989586621679108461"><span class="hs-identifier hs-var">onErr</span></a></span></span><span> </span><span id="local-6989586621679108460"><span class="annot"><span class="annottext">Maybe Word8
</span><a href="#local-6989586621679108460"><span class="hs-identifier hs-var">mb</span></a></span></span><span> </span><span id="local-6989586621679108459"><span class="annot"><span class="annottext">s
</span><a href="#local-6989586621679108459"><span class="hs-identifier hs-var">i</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-206"></span><span>    </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">OnDecodeError
</span><a href="#local-6989586621679108461"><span class="hs-identifier hs-var">onErr</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679108458"><span class="hs-identifier hs-var">desc</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe Word8
</span><a href="#local-6989586621679108460"><span class="hs-identifier hs-var">mb</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-207"></span><span>      </span><span class="annot"><span class="annottext">Maybe Char
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">s -&gt; Step s Char
forall s a. s -&gt; Step s a
</span><a href="Data.Text.Internal.Fusion.Types.html#Skip"><span class="hs-identifier hs-var">Skip</span></a></span><span> </span><span class="annot"><span class="annottext">s
</span><a href="#local-6989586621679108459"><span class="hs-identifier hs-var">i</span></a></span><span>
</span><span id="line-208"></span><span>      </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621679108457"><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621679108457"><span class="hs-identifier hs-var">c</span></a></span></span><span>  </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Char -&gt; s -&gt; Step s Char
forall s a. a -&gt; s -&gt; Step s a
</span><a href="Data.Text.Internal.Fusion.Types.html#Yield"><span class="hs-identifier hs-var">Yield</span></a></span><span> </span><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621679108457"><span class="hs-identifier hs-var">c</span></a></span><span> </span><span class="annot"><span class="annottext">s
</span><a href="#local-6989586621679108459"><span class="hs-identifier hs-var">i</span></a></span><span>
</span><span id="line-209"></span><span>    </span><span class="hs-keyword">where</span><span> </span><span id="local-6989586621679108458"><span class="annot"><span class="annottext">desc :: String
</span><a href="#local-6989586621679108458"><span class="hs-identifier hs-var hs-var">desc</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;Data.Text.Internal.Encoding.Fusion.&quot;</span></span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679108463"><span class="hs-identifier hs-var">func</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;: Invalid &quot;</span></span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span>
</span><span id="line-210"></span><span>                 </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679108462"><span class="hs-identifier hs-var">kind</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot; stream&quot;</span></span><span>
</span><span id="line-211"></span><span>
</span><span id="line-212"></span><span class="annot"><a href="Data.Text.Internal.Encoding.Fusion.html#word8ToWord16"><span class="hs-identifier hs-type">word8ToWord16</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Word.html#Word8"><span class="hs-identifier hs-type">Word8</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Word.html#Word16"><span class="hs-identifier hs-type">Word16</span></a></span><span>
</span><span id="line-213"></span><span id="word8ToWord16"><span class="annot"><span class="annottext">word8ToWord16 :: Word8 -&gt; Word16
</span><a href="Data.Text.Internal.Encoding.Fusion.html#word8ToWord16"><span class="hs-identifier hs-var hs-var">word8ToWord16</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Word8 -&gt; Word16
forall a b. (Integral a, Num b) =&gt; a -&gt; b
</span><a href="../../base/src/GHC.Real.html#fromIntegral"><span class="hs-identifier hs-var">fromIntegral</span></a></span><span>
</span><span id="line-214"></span><span>
</span><span id="line-215"></span><span class="annot"><a href="Data.Text.Internal.Encoding.Fusion.html#word8ToWord32"><span class="hs-identifier hs-type">word8ToWord32</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Word.html#Word8"><span class="hs-identifier hs-type">Word8</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Word.html#Word32"><span class="hs-identifier hs-type">Word32</span></a></span><span>
</span><span id="line-216"></span><span id="word8ToWord32"><span class="annot"><span class="annottext">word8ToWord32 :: Word8 -&gt; Word32
</span><a href="Data.Text.Internal.Encoding.Fusion.html#word8ToWord32"><span class="hs-identifier hs-var hs-var">word8ToWord32</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Word8 -&gt; Word32
forall a b. (Integral a, Num b) =&gt; a -&gt; b
</span><a href="../../base/src/GHC.Real.html#fromIntegral"><span class="hs-identifier hs-var">fromIntegral</span></a></span><span>
</span><span id="line-217"></span></pre></body></html>